import { Injectable } from "@angular/core";
import { Http } from '@angular/http';

Injectable()
/**
 * data - provider interface.
 * 
 * @export
 * @interface IProvider
 */
export interface IProvider {
    set(http: Http): void;

    // start =====  general functions of RESTFul & Websocket & Mock =====
    /**
     * Common Interface Funtion - query
     * 
     * @param {Function} sucCallback
     * @param {Function} failedCallback
     * 
     * @memberOf IProvider
     */
    query(paras: any, sucCallback: Function, failCallback: Function): void;

    /**
     * Common Interface Funtion - get
     * 
     * @param {*} paras
     * @param {Function} sucCallback
     * @param {Function} failCallback
     * 
     * @memberOf IProvider
     */
    get(paras: any, sucCallback: Function, failCallback: Function): void;

    /**
     * Common Interface Funtion - add
     * 
     * @param {*} paras
     * @param {Function} sucCallback
     * @param {Function} failCallback
     * 
     * @memberOf IProvider
     */
    add(paras: any, sucCallback: Function, failCallback: Function): void;

    /**
     * Common Interface Funtion - update
     * 
     * @param {*} paras
     * @param {Function} sucCallback
     * @param {Function} failCallback
     * 
     * @memberOf IProvider
     */
    update(paras: any, sucCallback: Function, failCallback: Function): void;

    /**
     * Common Interface Funtion - delete
     * 
     * @param {*} paras
     * @param {Function} sucCallback
     * @param {Function} failCallback
     * 
     * @memberOf IProvider
     */
    delete(paras: any, sucCallback: Function, failCallback: Function): void;
    // end ===== general functions of RESTFul & Websocket =====  

    // start ===== special functions of Websocket =====
    /**
     * Websocket Function - invoke proxy
     * 
     * @param {*} paras
     * @param {Function} sucCallback
     * @param {Function} failCallback
     * 
     * @memberOf IProvider
     */
    invokeProxy(paras: any, sucCallback: Function, failCallback: Function): void;

    /**
     * Websocket Function - stop request via requestId
     * 
     * @param {number} requestId
     * @param {Function} sucCallback
     * @param {Function} failCallback
     * 
     * @memberOf IProvider
     */
    stopRequest(requestId: number, sucCallback: Function, failCallback: Function): void;

    /**
     * Websocket Function - stop all requests
     * 
     * @param {Function} sucCallback
     * @param {Function} failCallback
     * 
     * @memberOf IProvider
     */
    stopAllRequests(sucCallback: Function, failCallback: Function): void;

    /**
     * Websocket Function - close connection
     * 
     * @param {Function} sucCallback
     * @param {Function} failCallback
     * 
     * @memberOf IProvider
     */
    closeConnection(sucCallback: Function, failCallback: Function): void;

    /**
     * Websocket Function - open connection
     * 
     * @param {Function} sucCallback
     * @param {Function} failCallback
     * 
     * @memberOf IProvider
     */
    openConnection(token: string, sucCallback: Function, failCallback: Function): void;
    // end ===== special functions of Websocket =====
}